import { request } from '@/http/axios';
import { IBase, IRecords } from '../app';

export interface IBook extends IBase{
  id?: number;
  typeId: number | string;
  bookName: string;
  author: string;
  stock: number;
  cover: string;
}

function records(data) {
  return request<IRecords<IBook>>({
    url: '/book/records',
    method: 'POST',
    data
  });
}

function upgrade(data) {
  return request({
    url: '/book/upgrade',
    method: 'POST',
    data
  });
}

function del(id) {
  return request({
    url: '/book/del',
    method: 'GET',
    params: {
      id
    }
  });
}

export const bookModel = {
  records,
  upgrade,
  del
};
